#include "stdafx.h"
#include "observer.h"


int main(int argc,char * argv[])
{
	char * buff = (char*)malloc(50);
	memset(buff, 0, 50);
	CNotifier * insNotifier = new CNotifier();
	CDisplay * insDisplay = new CDisplay();
	CAnalyze * insAnalyze = new CAnalyze();

	insDisplay->registerEvent(insNotifier);
	insAnalyze->registerEvent(insNotifier);


	for (int i = 0; i < 5; i++)
	{
		if (gets_s(buff,50))
		{
			insNotifier->notify(buff, (int)strlen(buff));

			memset(buff,0,50);
		}
	}

	delete insNotifier;
	delete insDisplay;
	delete insAnalyze;

	free(buff);
	
	return 0;
}